#ifndef LEILICONFIG_H
#define LEILICONFIG_H

#include <QObject>
#include <QSettings>
#include "tools/Singleton.h"


class LeiliConfig : public QObject
{
    Q_OBJECT
public:
    explicit LeiliConfig(QObject *parent = nullptr);

    void load(QString path);
    void save();


    //设置研磨盘直径(m)
    void setGrindingPanDiameter(double dia);
    double getGrindingPanDiameter();


    //重叠宽度
    void setOverlapWidth(double width);
    double getOverlapWidth();

    void setRobotNum(int robotNum);
    int getRobotNum();


    void setSavePath(QString path);
    QString getSavePath();

    void setGridLimitMin(double val);
    double getGridLimitMin();

    void setGridLimitMax(double val);
    double getGridLimitMax();


    // 文件操作
    void sync();

private:
    void writeValue(const QString &section, const QString &key,
                       const QVariant &value);


signals:


private:
    double m_grindingPanDiameter;
    double m_overlapWidth;
    double m_gridLimitMin;
    double m_gridLimitMax;
    int  m_robotNum;
    QString m_savePath;

    QSettings *m_settings;

};

#define LeiliCfg Singleton<LeiliConfig>::getInstance()

#endif // LEILICONFIG_H
